<?php

//礼券密码表
class auction extends spModel
{
	public $pk = "id"; // 数据表的主键
    public $table = "auctions"; // 数据表的名称

	function create($row) {
		$mTicket  = spClass('ticket');
		$rowT	  = $mTicket->find(array('id'=>$row['tid']));

		$mUserLog = spClass('userlog');
		$logArray	  = array(
							'uid' => $_SESSION['uid'],
							'type'=> 'auction',
							'content' => 'Use '. $row['bid']. ' for Auction ' . $rowT['name'],
							'dateline'=> time()
						);
		$lastLogId    = $mUserLog->create($logArray);

		$mUserCashLog = spClass('usercashlog');
		$cashLogArray	  = array(
							'uid' => $_SESSION['uid'],
							'logid' => $lastLogId,
							'amount'=> $row['bid'],
							'dateline'=> time()
						);
		$mUserCashLog->create($cashLogArray);

		parent::create($row);
	}
}